package service.impl;

import dao.UserMapper;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import service.UserService;

import java.util.List;

@Transactional

@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userDao;


    public UserMapper getUserDao() {
        return userDao;
    }

    public void setUserDao(UserMapper userDao) {
        this.userDao = userDao;
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public List<User> getUserList(User user) {
        return userDao.getUserList(user);
    }

    @Override
    public int addUser(User user) {
        return userDao.add(user);
    }
}
